package com.example.mobile2021606144ywr0407homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity8 extends AppCompatActivity {

    private TextView tvMainTitle7;
    private TextView tvMain71;
    private TextView tvMain72;
    private TextView tvMain73;
    private EditText editMain71;
    private Button btnMain7End;
    private TextView txt6;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);
        initView();
        btnMain7End.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = editMain71.getText().toString();
                txt6.setText(String.valueOf(string.length()+"位数"));
                int b = Integer.parseInt(string);
                txt6.setText(String.valueOf(b)+" ");
                StringBuffer buffer = new StringBuffer(String.valueOf(b));
                txt6.setText(buffer.reverse());
            }
        });
    }

    private void initView() {
        tvMainTitle7 = (TextView) findViewById(R.id.tv_main_title7);
        tvMain71 = (TextView) findViewById(R.id.tv_main7_1);
        tvMain72 = (TextView) findViewById(R.id.tv_main7_2);
        tvMain73 = (TextView) findViewById(R.id.tv_main7_3);
        editMain71 = (EditText) findViewById(R.id.edit_main7_1);
        btnMain7End = (Button) findViewById(R.id.btn_main7_end);
        txt6 = (TextView) findViewById(R.id.txt6);
    }
}